package edu.lit.cn.controller;

import com.alibaba.fastjson.JSON;
import edu.lit.cn.service.MDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
@CrossOrigin
@RestController
@RequestMapping("tem")
public class MDataController {
    @Autowired
    MDataService mDataService;
//    @CrossOrigin(origins = {"http://localhost:8081","null"})
    @GetMapping("getTem")
    public Object getAll(){
        ArrayList<HashMap<String, Object>> all = mDataService.getAll();
        return JSON.toJSON(all);
    }

}
